package com.authine.cloudpivot.ext.controller;

import com.alibaba.fastjson.JSON;
import com.authine.cloudpivot.engine.api.facade.BizObjectFacade;
import com.authine.cloudpivot.engine.api.model.organization.RoleUserModel;
import com.authine.cloudpivot.engine.api.model.organization.UserModel;
import com.authine.cloudpivot.engine.api.model.runtime.BizObjectCreatedModel;
import com.authine.cloudpivot.engine.api.model.runtime.BizObjectModel;
import com.authine.cloudpivot.engine.api.model.runtime.BizObjectQueryModel;
import com.authine.cloudpivot.engine.component.query.api.FilterExpression;
import com.authine.cloudpivot.engine.component.query.api.Order;
import com.authine.cloudpivot.engine.component.query.api.Page;
import com.authine.cloudpivot.engine.component.query.api.helper.PageableImpl;
import com.authine.cloudpivot.engine.component.query.api.helper.Q;
import com.authine.cloudpivot.engine.enums.type.BizPropertyType;
import com.authine.cloudpivot.engine.enums.type.DefaultPropertyType;
import com.authine.cloudpivot.ext.utils.SchemaUtils;
import com.authine.cloudpivot.foundation.orm.api.model.OrderByField;
import com.authine.cloudpivot.web.api.controller.base.BaseController;
import com.authine.cloudpivot.web.api.view.ResponseResult;
import com.google.common.collect.Lists;
import com.sun.corba.se.spi.ior.ObjectKey;
import javafx.beans.property.ReadOnlySetProperty;
import jdk.nashorn.internal.runtime.regexp.joni.Regex;
import jodd.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.poi.xslf.usermodel.XSLFPictureShape;
import org.hibernate.query.internal.NativeQueryImpl;
import org.hibernate.transform.Transformers;
import org.hibernate.type.OrderedSetType;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.ws.rs.GET;
import java.io.InputStream;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;

@Slf4j
@RestController
@RequestMapping("/api/protalhome")
public class PortalHomePage extends BaseController {

    @PersistenceContext
    EntityManager entityManager;

    /**
     * 获取课程分类属性
     */
    @GetMapping("/getcoursecalss")
    public ResponseResult getCourseClass() {
        String kcflTableName = getBizObjectFacade().getTableName("kcflbm");
        String kcxlTableName = getBizObjectFacade().getTableName("kcxlbm");
        String kclbTableName = getBizObjectFacade().getTableName("kclbbm");
        String kcsxTableName = getBizObjectFacade().getTableName("kcsxbm");
        Map<String, Object> resultList = new HashMap<>();
        //课程分类
        StringBuilder kcflsql = new StringBuilder();
        kcflsql.append("SELECT id,kcflmc FROM ").append(kcflTableName).append(" order by kcflmc desc");
        List<Map<String, Object>> kcfllist = entityManager.createNativeQuery(kcflsql.toString()).unwrap(NativeQueryImpl.class)
                .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
        //课程分类
        List<String> kcflmc = kcfllist.stream().map(m -> (String) m.get("kcflmc")).collect(Collectors.toList());
        Iterator<String> iterator = kcflmc.iterator();
        while (iterator.hasNext()) {
            String str = iterator.next();
            if ("其他".equals(str)) {
                iterator.remove();
            }
        }
        for (int i = 1; i < kcflmc.size(); i++) {
            Collections.swap(kcflmc, i, 3);
        }
        resultList.put("courseClass", kcflmc);

        //课程系列
        StringBuilder kcxlsql = new StringBuilder();
        kcxlsql.append("SELECT id,kcxlmc FROM ").append(kcxlTableName);
        List<Map<String, Object>> kcxllist = entityManager.createNativeQuery(kcxlsql.toString()).unwrap(NativeQueryImpl.class)
                .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();

        //课程类别
        StringBuilder kclbsql = new StringBuilder();
        kclbsql.append("SELECT id,kcxlmc,kclbmc FROM ").append(kclbTableName);
        List<Map<String, Object>> kclblist = entityManager.createNativeQuery(kclbsql.toString()).unwrap(NativeQueryImpl.class)
                .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
        //课程属性
        StringBuilder kcsxsql = new StringBuilder();
        kcsxsql.append("SELECT id,kclbmc,kcsxmc FROM ").append(kcsxTableName);
        List<Map<String, String>> kcsxlist = entityManager.createNativeQuery(kcsxsql.toString()).unwrap(NativeQueryImpl.class)
                .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();

        List<Map<String, Object>> mapList = new ArrayList<>();
        List<String> kcxl = kcxllist.stream().map(m -> (String) m.get("kcxlmc")).collect(Collectors.toList());
        for (String xl : kcxl) {
            Map<String, Object> m1 = new HashMap<>();
            //课程系列
            m1.put("courseSeries", xl);
            //获取对应课程类别
            StringBuilder getkclb = new StringBuilder();
            getkclb.append("SELECT kclbmc FROM `iwrwy_kclbbm`  where kcxlmc='").append(xl).append("'");
            List<Map<String, Object>> kclb = entityManager.createNativeQuery(getkclb.toString()).unwrap(NativeQueryImpl.class)
                    .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();

            List<Map<String, Object>> slist = new ArrayList<>();
            for (Map m : kclb) {
                Map<String, Object> m2 = new HashMap<>();
                //课程类别
                m2.put("courseCategory", m.get("kclbmc"));
                StringBuilder getkcsx = new StringBuilder();
                //获取对应课程属性
                getkcsx.append("SELECT kcsxmc FROM `iwrwy_kcsxbm`  where kclbmc='").append(m.get("kclbmc")).append("'");
                List<Map<String, Object>> kcsx = entityManager.createNativeQuery(getkcsx.toString()).unwrap(NativeQueryImpl.class)
                        .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
                if (CollectionUtils.isNotEmpty(kcsx)) {
                    m2.put("children", kcsx);
                }
                slist.add(m2);
                m1.put("children", slist);
            }

            mapList.add(m1);
        }
        resultList.put("data", mapList);
        return getOkResponseResult(resultList, "1");
    }

    /**
     * 轮播图
     */
    @GetMapping("/getphoto")
    public ResponseResult getPhoto() {
//        StringBuilder  sql=new StringBuilder();
//        sql.append("SELECT id,refId,name,mimeType FROM h_biz_attachment WHERE bizPropertyCode = 'tp' AND schemaCode = 'lbtpz'");
//        List<Map<String, Object>> sqllist = entityManager.createNativeQuery(sql.toString()).unwrap(NativeQueryImpl.class)
//                .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
//        if (CollectionUtils.isEmpty(sqllist)){
//            return  getErrResponseResult(500L,"无数据");
//        }
//        List<Map<String,String>> list=new ArrayList<>();
//        for (Map m: sqllist) {
//            Map<String,String> result = new HashMap<>();
//            result.put("id",(String) m.get("id"));
//            result.put("name",(String) m.get("name"));
//            result.put("Type",(String)m.get("mimeType"));
//            String refId =(String) m.get("refId");
//            HttpGet httpGet = new HttpGet("http://120.24.111.201/api/api/aliyun/download" + "?refId=" + refId);
//            InputStream in = null;
//            try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
//                RequestConfig timeoutconfig = RequestConfig.custom().setConnectTimeout(5000).
//                        setConnectionRequestTimeout(5000).setSocketTimeout(5000).build();
//                httpGet.setConfig(timeoutconfig);
//                HttpResponse response = httpClient.execute(httpGet);
//                StatusLine statusLine = response.getStatusLine();
//                int statuscode = statusLine.getStatusCode();
//                if (statuscode == 200) {
//                    HttpEntity httpEntity = response.getEntity();
//                    in = httpEntity.getContent();
//                    byte[] bytes = IOUtils.toByteArray(in);
//                    String s = Base64.getEncoder().encodeToString(bytes);
//                    result.put("image",s);
//                }
//            } catch (Exception e) {
//                log.info("获取文件失败");
//                e.printStackTrace();
//            }
//            list.add(result);
//        }
//        return getOkResponseResult(list,"获取数据成功");
        return getPhoto2();
    }


    private ResponseResult getPhoto2() {

        String schemaCode = "lbtpz";

        BizObjectQueryModel query = new BizObjectQueryModel();

        query.setSchemaCode(schemaCode);
        query.setQueryCode(schemaCode);

        query.setPageable(new PageableImpl(0, 1));

        query.setFilterExpr(Q.it("qy", FilterExpression.Op.Eq, true));
        query.setOrderType(Order.Dir.DESC.ordinal());
        query.setOrderByFields(Lists.newArrayList(DefaultPropertyType.MODIFIED_TIME.getCode()));


        Page<BizObjectModel> page = getBizObjectFacade().queryBizObjects(query);

        // nginx 里配置 lbt 指向sftp
        String photoPath = "/lbt/";

        if (page.getTotal() > 0) {
            List<String> collect = page.getContent().stream().flatMap(bizObjectModel -> {
                List<Map<String, Object>> tpList = (List<Map<String, Object>>) bizObjectModel.getObject("tp");
                return tpList.stream().map(m -> photoPath.concat(MapUtils.getString(m, "refId", ""))
                        .concat(MapUtils.getString(m, "name", "")));
            }).collect(Collectors.toList());
            return getOkResponseResult(collect, "成功");
        }

        return getErrResponseResult(-1L, "未获取到轮播图");
    }


    /**
     * 获取最新，精品，最热课程
     */
    @GetMapping("/getHotCourse")
    public ResponseResult getHotCourse(String param) {
        if (StringUtil.isEmpty(param)) {
            return getErrResponseResult(500L, "参数为空");
        }
        BizObjectFacade bizObjectFacade = getBizObjectFacade();
        String kcqdTableName = bizObjectFacade.getTableName("kcqd");
        List<Map<String, Object>> resultList = new ArrayList<>();
        if ("最新".equals(param)) {
            //StringBuilder sql=new StringBuilder("SELECT *  FROM `iwrwy_kcqd` where (kczt = )  order by  createdTime desc limit 0,10");
            StringBuilder sql = new StringBuilder("SELECT *  FROM " + kcqdTableName + " where (kczt = '已启用' or kczt = '启用' or kczt is null) order by  createdTime desc limit 0,10;");
            resultList = entityManager.createNativeQuery(sql.toString()).unwrap(NativeQueryImpl.class)
                    .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
        }
        if ("最热".equals(param)) {
            StringBuilder sql = new StringBuilder("SELECT *  FROM " + kcqdTableName + "  where (kczt = '已启用' or kczt = '启用' or kczt is null) order by  djl desc limit 0,10");
            resultList = entityManager.createNativeQuery(sql.toString()).unwrap(NativeQueryImpl.class)
                    .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
        }
        if ("精品".equals(param)) {
            StringBuilder sql = new StringBuilder("SELECT *  FROM " + kcqdTableName + "   where psjb='精品' and (kczt = '已启用' or kczt = '启用' or kczt is null)  order by  djl desc limit 0,10");
            resultList = entityManager.createNativeQuery(sql.toString()).unwrap(NativeQueryImpl.class)
                    .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
        }
        for (Map m : resultList) {
            String id = (String) m.get("id");
            BizObjectCreatedModel bizObject = getBizObjectFacade().getBizObject("kcqd", id);
            Object attachment = bizObject.get("kcfm");
            m.put("kcfm", attachment);
        }
        return getOkResponseResult(resultList, "获取参数成功");
    }

    /**
     * 课程接口
     */
    @PostMapping("/getcourseList")
    public ResponseResult courseList(@RequestBody Map<String, String> map) {
        log.info("\n ==========map:{}", JSON.toJSONString(map));

        StringBuilder countSql = new StringBuilder("SELECT count(*) as count from iwrwy_kcqd as a ");

        Query query = entityManager.createNativeQuery(countSql.toString());

        StringBuilder whereStr = new StringBuilder(" where kczt='已启动' ");

        if (map.containsKey("kcfl")) {
            whereStr.append("and modality='").append(map.get("kcfl")).append("' ");
        }
        if (map.containsKey("kcxl")) {
            whereStr.append("and series='").append(map.get("kcxl")).append("' ");
        }
        if (map.containsKey("kclb")) {
            whereStr.append("and category='").append(map.get("kclb")).append("' ");
        }
        if (map.containsKey("kcsx")) {
            whereStr.append("and kcxl='").append(map.get("kcsx")).append("' ");
        }
        StringBuilder listsql = new StringBuilder();
        Integer page = MapUtils.getInteger(map, "page", 0);
        Integer size = MapUtils.getInteger(map, "size", 20);

        if (page > 0) {
            page = page * size;
            size = page + size;
        }
        BigInteger count = (BigInteger) query.getSingleResult();
        if (count.intValue() == 0) {
            return null;
        }
        listsql.append("select * from iwrwy_kcqd").append(whereStr).append(" limit ").append(page).append(",").append(size);
        List<Map<String, Object>> resultList = entityManager.createNativeQuery(listsql.toString()).unwrap(NativeQueryImpl.class)
                .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();

        Map<String, Object> result = new HashMap<>();
        ;
        result.put("total", count);
        result.put("data", resultList);
        return getOkResponseResult(result, "获取数据成功");
    }

    /**
     * 获取讲师档案
     */
    @GetMapping("/getInstructorFiles")
    public ResponseResult getInstructorFiles(@RequestParam String userId) {
        if (StringUtil.isEmpty(userId)) {
            return getErrResponseResult(500L, "参数为空");
        }
        StringBuilder sql = new StringBuilder();
        sql.append("select * from iwrwy_jskgl where xm like '%").append(userId).append("%' and przt='聘任' order by prsj  desc");
        List<Map<String, Object>> resultList = entityManager.createNativeQuery(sql.toString()).unwrap(NativeQueryImpl.class)
                .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
        if (CollectionUtils.isEmpty(resultList)) {
            return getErrResponseResult(500L, "未存在讲师档案");
        }
        String id = (String) resultList.get(0).get("id");
        return getOkResponseResult(id, "获取数据成功");
    }

    /**
     * 培训档案
     */
    @GetMapping("/getTrainingFiles")
    public ResponseResult getTrainingFiles(String gh) {
        //外出培训
        StringBuilder sql1 = new StringBuilder();
        sql1.append("SELECT pxmc,ks,pxjg,kssj,jssj from iwrwy_wcpx where gh ='").append(gh).append("'");
        List<Map<String, Object>> wcpxtList = entityManager.createNativeQuery(sql1.toString()).unwrap(NativeQueryImpl.class)
                .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();

        //内部培训
        StringBuilder sql2 = new StringBuilder();
        sql2.append("SELECT pxmc,ks,kssj,jssj from iwrwy_nbpx where gh ='").append(gh).append("'");
        List<Map<String, Object>> nbpxtList = entityManager.createNativeQuery(sql2.toString()).unwrap(NativeQueryImpl.class)
                .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();

        //线上培训
        StringBuilder sql3 = new StringBuilder();
        sql3.append("SELECT pxmc,ks,kssj,jssj from iwrwy_xspx where gh ='").append(gh).append("'");
        List<Map<String, Object>> xspxtList = entityManager.createNativeQuery(sql3.toString()).unwrap(NativeQueryImpl.class)
                .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();

        StringBuilder sql = new StringBuilder();
        String userId = getUserId();
        sql.append("select * from iwrwy_wdpxda where creater='").append(userId).append("'");
        List<Map<String, Object>> resultList = entityManager.createNativeQuery(sql.toString()).unwrap(NativeQueryImpl.class)
                .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();

        if (CollectionUtils.isEmpty(resultList)) {
            //为空则新建一张

            BizObjectCreatedModel biz = new BizObjectCreatedModel();
            biz.setSchemaCode("wdpxda");
            biz.setCreater(userId);
            if (CollectionUtils.isNotEmpty(wcpxtList)) {
                wcpxtList.stream().forEach(m -> m.put("rowStatus", "Added"));
                biz.put("wcpxzb", wcpxtList);
            }
            if (CollectionUtils.isNotEmpty(nbpxtList)) {
                nbpxtList.stream().forEach(m -> m.put("rowStatus", "Added"));
                biz.put("nbpxzb", nbpxtList);
            }
            if (CollectionUtils.isNotEmpty(xspxtList)) {
                xspxtList.stream().forEach(m -> m.put("rowStatus", "Added"));
                biz.put("xspxzb", xspxtList);
            }
            //创建表单
            String id = getBizObjectFacade().saveBizObject(userId, biz, false);
            return getOkResponseResult(id, "获取数据成功");
        } else {
            String id = (String) resultList.get(0).get("id");
            BizObjectCreatedModel biz = new BizObjectCreatedModel();
            biz.setSchemaCode("wdpxda");
            biz.setId(id);
            List<Map<String, Object>> nullmap=new ArrayList<>();
            biz.put("wcpxzb",nullmap);
            biz.put("nbpxzb", nullmap);
            biz.put("xspxzb", nullmap);
            getBizObjectFacade().saveBizObject(userId, biz, false);

            BizObjectCreatedModel biz1 = new BizObjectCreatedModel();
            biz1.setSchemaCode("wdpxda");
            biz1.setId(id);
            if (CollectionUtils.isNotEmpty(wcpxtList)) {
                wcpxtList.stream().forEach(m -> m.put("rowStatus", "Added"));
                biz1.put("wcpxzb", wcpxtList);
            }
            if (CollectionUtils.isNotEmpty(nbpxtList)) {
                nbpxtList.stream().forEach(m -> m.put("rowStatus", "Added"));
                biz1.put("nbpxzb", nbpxtList);
            }
            if (CollectionUtils.isNotEmpty(xspxtList)) {
                xspxtList.stream().forEach(m -> m.put("rowStatus", "Added"));
                biz1.put("xspxzb", xspxtList);
            }
            getBizObjectFacade().saveBizObject(userId, biz1, false);
            return getOkResponseResult(id, "获取数据成功");
        }

    }

    /**
     * 申报信息--提交按钮
     */
    @PostMapping("/submit")
    @Transactional
    public ResponseResult sunmit(@RequestBody List<String> list) {
        if (CollectionUtils.isEmpty(list)) {
            return getErrResponseResult(500L, "参数为空");
        }
        for (String s : list) {
            StringBuilder sql = new StringBuilder();
            sql.append("update iwrwy_jssb set dqjd='讲师_基层审核推荐',zt='已提交' where  id='").append(s).append("'");
            entityManager.createNativeQuery(sql.toString()).executeUpdate();
        }
        return getOkResponseResult("提交成功");
    }

    /**
     * 申报信息--撤回按钮  申报结束日期之前，且管理员已审核
     */
    @PostMapping("/withdraw")
    @Transactional
    public ResponseResult withdraw(@RequestBody List<String> list) {
        if (CollectionUtils.isEmpty(list)) {
            return getErrResponseResult(500L, "参数为空");
        }
        for (String s : list) {
            StringBuilder sql = new StringBuilder();
            sql.append("select sbjsrq,shjg from iwrwy_jssb where id ='").append(s).append("'");
            List<Map<String, Object>> resultList = entityManager.createNativeQuery(sql.toString()).unwrap(NativeQueryImpl.class)
                    .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
            if (CollectionUtils.isEmpty(resultList)){
                return getErrResponseResult(-1L,"未找到数据");
            }
            //申报结束日期
            Date sbjsrq =(Date) resultList.get(0).get("sbjsrq");
            LocalDate localDate = sbjsrq.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();

            String shjg =(String) resultList.get(0).get("shjg");
            LocalDate now = LocalDate.now();
            boolean before = now.isBefore(localDate);
            if (!before){
                return  getErrResponseResult(-1L,"当前日期已超过活动结束日期，不允许撤回");
            }
            if (StringUtil.isNotEmpty(shjg)){
                return  getErrResponseResult(-1L,"管理员已审核，不允许撤回");
            }
            sql.setLength(0);
            sql.append("update iwrwy_jssb set dqjd='申请人',zt='已撤销' where  id='").append(s).append("'");
            entityManager.createNativeQuery(sql.toString()).executeUpdate();
        }
        return getOkResponseResult("撤回成功");
    }

    /**
     * 应用可见权限
     */
    @GetMapping("/applyVisible")
    public ResponseResult applyVisiblePermissions(){
        String userId = getUserId();
        //先判断是否管理员
        StringBuilder sqlrole=new StringBuilder();
        sqlrole.append("SELECT * FROM `h_perm_admin`  where userId='").append(userId).append("'");
        List<Map<String, Object>> rolelist = entityManager.createNativeQuery(sqlrole.toString()).unwrap(NativeQueryImpl.class)
                .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
        if (CollectionUtils.isNotEmpty(rolelist)){
            return getOkResponseResult(true,"应用可见");
        }else {
            //非管理员判断角色
            StringBuilder sql = new StringBuilder();
            sql.append("select a.code code from h_org_role a join h_org_role_user b on a.id=b.roleId where b.userid='").append(userId).append("'");
            List<Map<String, Object>> resultlist = entityManager.createNativeQuery(sql.toString()).unwrap(NativeQueryImpl.class)
                    .setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).getResultList();
            if (CollectionUtils.isEmpty(resultlist)){
                return getErrResponseResult(500L, "应用不可见");
            }else {
                List<String> code = resultlist.stream().map(m ->(String) m.get("code")).collect(Collectors.toList());
                List<String> condition = new ArrayList<>(Arrays.asList("jcgly", "lrgly"));
                boolean flag=false;
                for (String s:code) {
                    if (condition.contains(s)) {
                        flag = true;
                    }
                }
                if (flag) {
                    return getOkResponseResult(true, "应用可见");
                } else {
                    return getErrResponseResult(500L, "应用不可见");
                }
            }
        }
    }

    /**
     * 获取配置应用
     */
    @GetMapping("/getapplication")
    public ResponseResult getApplication(){
        BizObjectQueryModel query = new BizObjectQueryModel();
        query.setSchemaCode("yyzxwh");
        query.setQueryCode("yyzxwh");
        query.setPageable(new PageableImpl(0,30));
        query.setFilterExpr(Q.it("enable", FilterExpression.Op.Eq, true));
        Page<BizObjectModel> page = getBizObjectFacade().queryBizObjects(query);
        List<Map<String,Object>> list = new ArrayList<>();
        if (page.getTotal()>0) {
            page.getContent().stream().forEach(biz -> {
                Map map = new HashMap();
                map.put("id", biz.get("id"));
                map.put("appname", biz.get("appname"));
                map.put("apppicture", biz.get("apppicture"));
                map.put("apprul", biz.get("apprul"));
                map.put("sort", biz.get("sort"));
                map.put("enable", biz.get("enable"));
                list.add(map);
            });

        }
        return  getOkResponseResult(list,"获取数据成功");
    }
}
